using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace Mundo_3D
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    class Nave : Modelo_Basico
    {
        public Nave(Model m, Texture2D tex): base(m, Tipo_Modelo.modelo, tex)
        {
           
        }

        public override void Update()
        {
            Matrix Tranaux = worldTranslation;
            Matrix Rotaaux = worldRotation;
            if (Keyboard.GetState().IsKeyDown(Keys.Y))
            {
                worldTranslation *= Matrix.CreateTranslation(0, 0, 1.0f);

            }

            if (Keyboard.GetState().IsKeyDown(Keys.H))
            {
                worldTranslation *= Matrix.CreateTranslation(0, 0, -1.0f);

            }

            if (Keyboard.GetState().IsKeyDown(Keys.J))
            {
                worldTranslation *= Matrix.CreateTranslation(-1.0f, 0, 0);

            }

            if (Keyboard.GetState().IsKeyDown(Keys.G))
            {
                worldTranslation *= Matrix.CreateTranslation(1.0f, 0, 0);

            }

            if (Keyboard.GetState().IsKeyDown(Keys.I))
            {
                worldTranslation *= Matrix.CreateTranslation(0, 1.0f, 0);

            }

            if (Keyboard.GetState().IsKeyDown(Keys.K))
            {
                worldTranslation *= Matrix.CreateTranslation(0, -1.0f, 0);
            }

            if (Keyboard.GetState().IsKeyDown(Keys.U))
            {
                worldRotation *= Matrix.CreateRotationY(-MathHelper.PiOver4 / 60);

            }

            if (Keyboard.GetState().IsKeyDown(Keys.T))
            {
                worldRotation *= Matrix.CreateRotationY(MathHelper.PiOver4 / 60);

            }

            if (Keyboard.GetState().IsKeyDown(Keys.O))
            {
                worldRotation *= Matrix.CreateRotationX(MathHelper.PiOver4 / 60);
            }

            if (Keyboard.GetState().IsKeyDown(Keys.L))
            {
                worldRotation *= Matrix.CreateRotationX(-MathHelper.PiOver4 / 60);
            }

            if (Keyboard.GetState().IsKeyDown(Keys.R))
            {
                worldRotation *= Matrix.CreateRotationZ(MathHelper.PiOver4 / 60);
            }

            if (Keyboard.GetState().IsKeyDown(Keys.F))
            {
                worldRotation *= Matrix.CreateRotationZ(-MathHelper.PiOver4 / 60);
            }

            if (worldTranslation.Translation.Y < 0)
                worldTranslation = Tranaux;

            world = worldRotation * worldTranslation;

            base.Update();
        }
    }
}